<template>
	<view class="page">
		<scroll-view style="height: calc(100vh - 75rpx);" scroll-y="true">
			<!-- 头部 -->
			<view class="shouye_top">
				<view class="shouye_logo_box">
					<view class="shouye_logo_top_box"></view>
					<view class="logo_text_box">
						在线开盒 | 正品保障 | 100%中奖
					</view>
				</view>
				<view class="call_box"></view>
			</view>
			<!-- 签到，福利屋 -->
			<view class="lingquan_box">
				<view class="dianjitupian_box" v-for="(item, index) in qdList" :key="index">
					<image :src="item.image" mode="" @click="tzdj(item.id)"></image>
				</view>
			</view>
			<!-- 轮播 -->
			<view class="sw_box">
				<swiper class="swiper" circular :indicator-dots="indicatorDots" :autoplay="autoplay"
					:interval="interval" :duration="duration">
					<swiper-item v-for="(item, index) in bannerList" :key="index">
						<image :src="item.image" mode="scaleToFill" />
					</swiper-item>
				</swiper>
			</view>
			<!-- 热门爆品 -->
			<view class="rm_box"></view>
			<view class="rm_dg_box">
				<view class="dg_gb_box" v-for="(item, index) in 10" :key="index">
					<view class="top_bgi_box">
						<image src="https://pockets.qixdian.cn/upload/20240711/668f855f1e084.png" mode="">
						</image>
					</view>
					<view class="bot_text_box">
						苹果高爆率168/抽
					</view>
				</view>
			</view>

			<!-- 盲盒区域 -->
			<view class="mh_fl_box">
				<view class="fl_text_box" v-for="(item, index) in mhflList" :key="index" @click="mhsx(item)">
					<view :class="selmhflId == item.id ? 'sel_wenzi_box' : ''" class="wenzi_box">
						{{ item.title }}
					</view>
					<view class="dl_box" v-if="selmhflId == item.id"></view>
				</view>
			</view>

			<view class="mh_big_box" :class="'mh_big_box_' + item.cat_id" v-for="(item, index) in mhList" :key="index"
				@click="goDetail(item)">
				<view class="left_tp_box">
					<image :src="item.image" mode=""></image>
					<!-- <image src="https://pockets.qixdian.cn/upload/20240711/668f855f1e084.png" mode="scaleToFill" /> -->
				</view>
				<view class="right_con_box">
					<view class="mh_name_box">
						{{ item.name }}
					</view>
					<view class="mh_price_box">
						¥{{ item.price }}
					</view>
					<view class="mh_text_box">
						在线开盒 正品保障 100%中奖
					</view>
					<view class="sm_mh_box">
						<view class="sm_pic_box" v-for="(items, indexs) in item.sonList" :key="indexs">
							<!-- <image :src="items.card_font" mode="">
							</image> -->
							<image src="https://pockets.qixdian.cn/upload/20240711/668f855f1e084.png"
								mode="scaleToFill" />
						</view>
					</view>
				</view>
			</view>
		</scroll-view>

	</view>
</template>
<script>
export default {
	data() {
		return {
			qdList: [{
				id: 1,
				image: 'https://pockets.qixdian.cn/upload/20240711/668f901d8df52.png'
			},
			{
				id: 2,
				image: 'https://pockets.qixdian.cn/upload/20240711/668f901d90544.png'
			},
			],
			indicatorDots: true,
			autoplay: true,
			interval: 2000,
			duration: 500,
			bannerList: [], //轮播
			mhflList: [{
				id: 0,
				title: '热门',
			},
			{
				id: 1,
				title: '无限',
			},
			{
				id: 2,
				title: '高爆',
			},
			],
			selmhflId: 1, //默认热门
			mhList: [], //盲盒列表

		}
	},
	onShow() {
		this.init()
		this.bannerBtn()
	},
	methods: {
		bannerBtn() {
			this.$Request.get(this.$api.index.banners).then(res => {
				this.bannerList = res.data
			})

		},
		init() {
			var data = {
				cat_id: this.selmhflId
			}
			this.$Request.get(this.$api.index.blindBox, data).then(res => {
				this.mhList = res.data.data.data
			})
		},
		// 签到,福利屋点击 1:签到 2:福利屋
		tzdj(id) {
			console.log(id)
		},
		// 盲盒筛选
		mhsx(item) {
			this.mhList
			this.selmhflId = item.id
			this.init()

		},
		// 跳转盲盒详情
		goDetail(item) {
			uni.navigateTo({
				url: "/homes/mhdetail?id=" + item.id
			})
		}
	}
}
</script>
<style lang="scss" scoped>
.page {
	width: 100vw;
	min-height: 100vh;
	background-image: url('https://pockets.qixdian.cn/upload/20240711/668f901db1770.png');
	background-size: 100% 100%;
	box-sizing: border-box;
	padding-top: 75rpx;
	position: fixed;
	top: 0;
	left: 0;

	.shouye_top {
		width: 100vw;
		height: 128rpx;
		box-sizing: border-box;
		padding: 0 30rpx 0 15rpx;
		display: flex;
		/* #ifdef APP-PLUS */
		justify-content: space-between;
		/* #endif */
		/* #ifdef MP-WEIXIN */
		justify-content: flex-start;
		/* #endif */

		align-items: center;

		.shouye_logo_box {
			// width: 490rpx;
			height: 127rpx;
			display: flex;
			justify-content: flex-start;
			align-items: center;

			/* #ifdef MP-WEIXIN */
			margin-right: 10rpx;
			/* #endif */

			.shouye_logo_top_box {
				width: 122rpx;
				height: 128rpx;
				background-image: url('https://pockets.qixdian.cn/upload/20240711/668f901d79499.png');
				background-size: 100% 100%;
				margin-right: 20rpx;
			}

			.logo_text_box {
				height: 24rpx;
				font-weight: 500;
				font-size: 24rpx;
				color: #fff;
				line-height: 18rpx;
			}
		}

		.call_box {
			width: 101rpx;
			height: 40rpx;
			background-image: url('https://pockets.qixdian.cn/upload/20240711/668f901d5ee1f.png');
			background-size: 100% 100%;
		}
	}


	.lingquan_box {
		width: 700rpx;
		height: 140rpx;
		margin: auto;
		display: flex;
		justify-content: space-between;
		align-items: center;
		margin-bottom: 40rpx;

		.dianjitupian_box {
			width: 333rpx;
			height: 140rpx;

			image {
				width: 100%;
				height: 100%;
			}

		}
	}

	// 轮播
	.sw_box {
		width: 700rpx;
		height: 260rpx;
		margin: auto;
		margin-bottom: 40rpx;


		.swiper {
			width: 700rpx;
			height: 260rpx;

			image {
				width: 100%;
				height: 100%;
			}
		}
	}

	.rm_dg_box::-webkit-scrollbar {
		display: none
	}

	// 热门爆品
	.rm_box {
		width: 151rpx;
		height: 57rpx;
		background-image: url('https://pockets.qixdian.cn/upload/20240711/668f901d79497.png');
		background-size: 100% 100%;
		margin-left: 23rpx;
		margin-bottom: 9rpx;
	}

	.rm_dg_box {
		width: 725rpx;
		height: 252rpx;
		margin-left: 23rpx;
		display: flex;
		justify-content: flex-start;
		margin-bottom: 20rpx;
		animation: move 7s linear infinite;
		white-space: nowrap;

		.dg_gb_box {
			width: 210rpx;
			height: 252rpx;
			margin-right: 20rpx;
			overflow-x: auto;
			flex-shrink: 0;

			.top_bgi_box {
				width: 210rpx;
				height: 210rpx;
				border-radius: 18rpx;
				margin-bottom: 20rpx;

				image {
					width: 100%;
					height: 100%;
					border-radius: 18rpx;
				}
			}

			.bot_text_box {
				width: 203rpx;
				height: 23rpx;
				margin: auto;
				font-family: PingFang SC;
				font-weight: 500;
				font-size: 24rpx;
				color: #FFFFFF;
				line-height: 23rpx;
				opacity: 0.6;
				overflow: hidden;
				text-overflow: ellipsis;
				white-space: nowrap;
			}
		}
	}

	.rm_dg_box:hover {
		animation: move 7s linear infinite paused;
	}

	@keyframes move {

		0% {
			transform: translateX(0rpx);
		}

		100% {
			//无缝重点：图片是300rpx，margin-right是20rpx，那就是需要左移 （300+20）*图片数rpx
			transform: translateX(-690rpx);
		}

	}

	// 盲盒区域
	.mh_fl_box {
		width: 100%;
		height: 92rpx;
		padding-left: 23rpx;
		display: flex;
		justify-content: flex-start;

		.fl_text_box {
			width: 80rpx;
			height: 92rpx;
			text-align: center;
			margin-right: 30rpx;
			position: relative;

			.dl_box {
				width: 78rpx;
				height: 38rpx;
				position: absolute;
				bottom: 16rpx;
				left: 0;
				right: 0;
				background-image: url('https://pockets.qixdian.cn/upload/20240711/668f901d675f2.png');
				background-size: 100% 100%;
			}

			.wenzi_box {
				font-family: PingFang SC;
				font-weight: bold;
				font-size: 32rpx;
				color: #FFFFFF;
				line-height: 80rpx;
				opacity: 0.6;

				&.sel_wenzi_box {
					font-family: Alimama ShuHeiTi;
					font-weight: bold;
					font-size: 36rpx;
					color: #FFFFFF;
					opacity: 1;
				}
			}


		}
	}

	.mh_big_box {
		width: 700rpx;
		height: 297rpx;
		margin: auto;
		background-size: 100% 100%;
		display: flex;
		justify-content: space-around;
		align-items: center;
		padding: 0 29rpx;
		box-sizing: border-box;
		margin-bottom: 28rpx;

		&.mh_big_box_0 {
			background-image: url('https://pockets.qixdian.cn/upload/20240711/668f901d972d9.png');
		}

		&.mh_big_box_1 {
			background-image: url('https://pockets.qixdian.cn/upload/20240711/668f901d99972.png');
		}

		&.mh_big_box_2 {
			background-image: url('https://pockets.qixdian.cn/upload/20240711/668f901d9f482.png');
		}

		.left_tp_box {
			width: 230rpx;
			height: 230rpx;
			border-radius: 18rpx;

			image {
				width: 100%;
				height: 100%;
				border-radius: 18rpx;
			}
		}

		.right_con_box {
			width: 386rpx;
			height: 230rpx;

			.mh_name_box {
				width: 370rpx;
				height: 28rpx;
				font-family: PingFang SC;
				font-weight: bold;
				font-size: 28rpx;
				color: #FFFFFF;
				line-height: 28rpx;
				overflow: hidden;
				text-overflow: ellipsis;
				white-space: nowrap;
				box-sizing: border-box;
				padding-left: 10rpx;
				margin-bottom: 26rpx;
			}

			.mh_price_box {
				width: 300rpx;
				height: 38rpx;
				font-family: PingFang SC;
				font-weight: bold;
				box-sizing: border-box;
				padding-left: 10rpx;
				font-size: 36rpx;
				color: #F56198;
				line-height: 38rpx;
				margin-bottom: 16rpx;
			}

			.mh_text_box {
				width: 300rpx;
				height: 20rpx;
				font-family: PingFang SC;
				font-weight: 500;
				font-size: 20rpx;
				color: #FFFFFF;
				line-height: 18rpx;
				box-sizing: border-box;
				padding-left: 10rpx;
				opacity: 0.5;
				margin-bottom: 18rpx;
			}

			.sm_mh_box {
				width: 386rpx;
				height: 84rpx;
				box-sizing: border-box;
				padding-left: 10rpx;
				display: flex;
				justify-content: space-between;
				align-items: center;

				.sm_pic_box {
					width: 84rpx;
					height: 84rpx;
					border-radius: 10rpx;

					image {
						width: 100%;
						height: 100%;
						border-radius: 10rpx;
					}
				}
			}
		}

	}

}
</style>
